<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>回顾Object.defineproperty</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>

    <script type="text/javascript">

        let number = 20;
        let person = {
            name:'trent',
            sex:'man'
        }
        Object.defineProperty(person,'age',{
            // value:18,
            // enumerable:true,
            // writable:true,
            // configurable:true

            get(){
                return number;
            },
            set:(value)=>{
                
            },
            set(value){
                console.log("有人修改属性")
                //this.age=value
                number=value
                console.log("this.age:"+JSON.stringify(this))

            },
            
        })
        console.log(person)
        
    </script>
</body>
 
</html>